<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AdvancedSearch.aspx.cs" Inherits="DatabaseReporting" Title="" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table id="Table1" cellpadding="5" cellspacing="0" width="100%">
    <tr>
        <td bgcolor="#EBE7E7">
                            <table style="width: 100%">
                                <tr>
                                    <td style="width: 138px"><asp:Label ID="lbl1" runat="server">Advanced Search</asp:Label></td>
                                    <td align="right" valign=middle style="width: 567px">
                                        <asp:RadioButtonList ID="optSearchType" runat="server" AutoPostBack="True" 
                                            onselectedindexchanged="optSearchType_SelectedIndexChanged1" 
                                            RepeatDirection="Horizontal">
                                            <asp:ListItem Selected="True">Instance</asp:ListItem>
                                            <asp:ListItem>Database</asp:ListItem>
                                        </asp:RadioButtonList>
                                        </td>
                                    <td align="right" valign="middle"><asp:ImageButton ID="btnSearch" runat="server" ImageUrl="~/Image/button_search.gif" onclick="btnSearch_Click" /></td>
                                </tr>
                            </table>
                        </td>
    </tr>
</table>
<table id="Table3" cellpadding="5" cellspacing="0" width="100%">
    <tr>
        <td>
        <table id="tblSearchInstance" runat=server cellpadding="1" cellspacing=0  width="100%">
    <tr>
        <td bgcolor="#EBE7E7">SELECT</td>
    </tr>
    <tr>
        <td><asp:CheckBoxList ID="SelectListInstance" runat="server" RepeatColumns="3" Width="100%"></asp:CheckBoxList></td>
    </tr>
    <tr>
        <td bgcolor="#EBE7E7">WHERE</td>
    </tr>
    <tr>
    <td>
        <table style="width: 100%">
            <tr>
                                                <td style="width: 210px">
                                                    <asp:CheckBox ID="WhereInstanceName1" runat="server" AutoPostBack="True" 
                                                        Text=" Instance Name" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblInstanceNameLike" runat="server" Text="Like"></asp:Label></td>
                                                <td>
                                                    <asp:TextBox ID="txtInstanceName1" runat="server" Width="420px"></asp:TextBox></td>
                                            </tr>
            <tr>
                                                <td style="width: 210px">
                                                    <asp:CheckBox ID="WhereInstanceIsBusinessCritical" runat="server" AutoPostBack="True" 
                                                        Text=" BusinessCritical" /></td>
                                                <td align="Center" style="width: 50px">
                                                    <asp:Label ID="lblInstanceIsBusinessCritical" runat="server" Text="Is"></asp:Label></td>
                                                <td>
                                                    <asp:RadioButtonList ID="rdoInstanceIsBusinessCritical" runat="server" 
                                                        RepeatDirection="Horizontal" Width="288px">
                                                        <asp:ListItem Selected="True" Value="1">True</asp:ListItem>
                                                        <asp:ListItem Value="0">False</asp:ListItem>
                                                    </asp:RadioButtonList></td>
                                            </tr>
            <tr>
                                                <td style="width: 210px">
                                                    <asp:CheckBox ID="WhereInstanceCollation" runat="server" AutoPostBack="True" Text=" Instance Collation" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblInstanceCollationEqual" runat="server" Text="="></asp:Label></td>
                                                <td>
                                                    <asp:DropDownList ID="ddlInstanceCollation" runat="server" Width="450px">
                                                    </asp:DropDownList></td>
                                            </tr>
            <tr>
                                                <td style="width: 210px">
                                                    <asp:CheckBox ID="WhereInstanceOSVersion" runat="server" AutoPostBack="True" Text=" Instance OS Version" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblInstanceOSVersionEqual" runat="server" Text="="></asp:Label></td>
                                                <td>
                                                    <asp:DropDownList ID="ddlInstanceOSVersion" runat="server" Width="450px">
                                                    </asp:DropDownList></td>
                                            </tr>
            <tr>
                                                <td style="width: 210px">
                                                    <asp:CheckBox ID="WhereInstanceSQLVersion" runat="server" AutoPostBack="True" Text=" Instance SQL Version" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblInstanceSQLVersionEqual" runat="server" Text="="></asp:Label></td>
                                                <td>
                                                    <asp:DropDownList ID="ddlInstanceSQLVersion" runat="server" Width="450px">
                                                    </asp:DropDownList></td>
                                            </tr>
            <tr>
                                                <td style="width: 210px" valign=top>
                                                    <asp:CheckBox ID="WhereInstanceIsClustered" runat="server" AutoPostBack="True" Text=" Instance Is Clustered" /></td>
                                                <td align="center" style="width: 50px" valign=top>
                                                    <asp:Label ID="lblInstanceIsClusteredEqual" runat="server" Text="Is"></asp:Label></td>
                                                <td>
                                                    <asp:RadioButtonList ID="rdoInstanceIsClustered" runat="server" RepeatDirection="Horizontal" Width="288px">
                                                        <asp:ListItem Selected="True" Value="1">Clustered</asp:ListItem>
                                                        <asp:ListItem Value="0">Not Clustered</asp:ListItem>
                                                    </asp:RadioButtonList></td>
                                            </tr>
            <tr>
                                                <td style="width: 210px" valign=top>
                                                    <asp:CheckBox ID="WhereInstanceIsVirtual" runat="server" AutoPostBack="True" 
                                                        Text=" Instance Is Virtual" /></td>
                                                <td align="center" style="width: 50px" valign=top>
                                                    <asp:Label ID="lblInstanceIsVirtual" runat="server" Text="Is"></asp:Label></td>
                                                <td>
                                                    <asp:RadioButtonList ID="rdoInstanceIsVirtual" runat="server" 
                                                        RepeatDirection="Horizontal" Width="288px">
                                                        <asp:ListItem Selected="True" Value="1">Virtual</asp:ListItem>
                                                        <asp:ListItem Value="0">Physical</asp:ListItem>
                                                    </asp:RadioButtonList></td>
                                            </tr>
        </table>
    </td>
    </tr>
</table>
<table id="tblSearchDatabase" runat=server cellpadding="1"  width="100%">
                                <tr>
                                    <td bgcolor="#EBE7E7">SELECT</td>
                                </tr>
                                <tr>
                                    <td style="width: 30%" valign="top">
                                        <asp:CheckBoxList ID="SelectList" runat="server" RepeatColumns="3" Width="100%">
                                        </asp:CheckBoxList></td>
                                </tr>
                                <tr>
                                    <td bgcolor="#EBE7E7">WHERE</td>
                                </tr>
                                <tr>
                                    <td valign="top" style="width: 30%">
                                        <table style="width: 100%">
                                            <tr>
                                                <td width=210><asp:CheckBox ID="WhereInstanceDomain" runat="server" 
                                                        AutoPostBack="True" Text=" Instance Domain Name" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lbInstanceDomainNameEqual" runat="server" Text="="></asp:Label></td>
                                                <td>
                                                    <asp:DropDownList ID="ddlInstanceDomainName" runat="server" Width="450px">
                                                    </asp:DropDownList></td>
                                            </tr>
                                            <tr>
                                                <td width=210><asp:CheckBox ID="WhereInstanceName2" runat="server" AutoPostBack="True" Text=" Instance Name" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblDatabaseInstanceNameLike" runat="server" Text="Like"></asp:Label></td>
                                                <td><asp:TextBox ID="txtInstanceName2" runat="server" Width="420px"></asp:TextBox></td>
                                            </tr>
                                            <tr>
                                                <td width=210><asp:CheckBox ID="WhereDatabaseName" runat="server" AutoPostBack="True" Text=" Database Name" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblDatabaseNameLike" runat="server" Text="Like"></asp:Label></td>
                                                <td><asp:TextBox ID="txtDatabaseName" runat="server" Width="420px"></asp:TextBox></td>
                                            </tr>
                                            <tr>
                                                <td width=210><asp:CheckBox ID="WhereSizeMB" runat="server" AutoPostBack="True" Text=" Database Size" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblDatabaseSizeIs" runat="server" Text="Is"></asp:Label></td>
                                                <td>
                                                    <asp:DropDownList ID="ddlDatabaseSizeMB" runat="server" Width="125px">
                                                        <asp:ListItem Value="&lt; 1000">&lt; 1GB</asp:ListItem>
                                                        <asp:ListItem>&gt; 1 GB</asp:ListItem>
                                                        <asp:ListItem Value="&gt; 5000">&gt; 5 GB</asp:ListItem>
                                                        <asp:ListItem Value="&gt; 10000">&gt; 10 GB</asp:ListItem>
                                                        <asp:ListItem Value="&gt; 50000">&gt; 50 GB</asp:ListItem>
                                                        <asp:ListItem Value="&gt; 100000">&gt; 100 GB</asp:ListItem>
                                                        <asp:ListItem Value="&gt; 1000000">&gt; 1 TB</asp:ListItem>
                                                    </asp:DropDownList></td>
                                            </tr>
                                            <tr>
                                                <td width="210">
                                                    <asp:CheckBox ID="WhereFreeSpace" runat="server" AutoPostBack="True" 
                                                        Text=" Data FreeSpace Avail Pct" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblDatabaseSpaceAvailablePct" runat="server" Text="Is"></asp:Label>
                                                </td>
                                                <td>
                                                    <asp:DropDownList ID="ddlDatabaseSpaceAvailablePct" runat="server" 
                                                        Width="125px">
                                                        <asp:ListItem Value="5.00">&lt; 5%</asp:ListItem>
                                                        <asp:ListItem Value="10.00">&lt; 10%</asp:ListItem>
                                                        <asp:ListItem Selected="True" Value="20.00">&lt; 20%</asp:ListItem>
                                                    </asp:DropDownList>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width=210><asp:CheckBox ID="WhereRecoveryModel" runat="server" AutoPostBack="True" Text=" Recovery Model" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblDatabaseRevoveryModelEqual" runat="server" Text="="></asp:Label></td>
                                                <td>
                                                    <asp:DropDownList ID="ddlRecoveryModel" runat="server" Width="450px">
                                                        <asp:ListItem>Simple</asp:ListItem>
                                                        <asp:ListItem>Full</asp:ListItem>
                                                        <asp:ListItem>Bulk-Logged</asp:ListItem>
                                                    </asp:DropDownList></td>
                                            </tr>
                                            <tr>
                                                <td width="210">
                                                    <asp:CheckBox ID="WhereAuto" runat="server" AutoPostBack="True" Text=" Auto" />
                                                    <asp:DropDownList ID="ddlAuto" runat="server" Width="139px">
                                                        <asp:ListItem Value="AutoShrink">Shrink</asp:ListItem>
                                                        <asp:ListItem Value="AutoUpdateStatistics">UpdateStatistics</asp:ListItem>
                                                        <asp:ListItem Value="AutoCreateStatistics">CreateStatistics</asp:ListItem>
                                                        <asp:ListItem Value="AutoClose">Close</asp:ListItem>
                                                    </asp:DropDownList></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblAutoEqual" runat="server" Text="Is"></asp:Label></td>
                                                <td>
                                                    <asp:RadioButtonList ID="rdoAuto" runat="server" RepeatDirection="Horizontal" Width="164px">
                                                        <asp:ListItem Selected="True" Value="1">True</asp:ListItem>
                                                        <asp:ListItem Value="0">False</asp:ListItem>
                                                    </asp:RadioButtonList></td>
                                            </tr>
                                            <tr>
                                                <td width="210">
                                                    <asp:CheckBox ID="WhereTrustworthy" runat="server" AutoPostBack="True" Text=" Trustworthy" />
                                                </td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblDatabaseTrustworthyEqual" runat="server" Text="="></asp:Label></td>
                                                <td>
                                                    <asp:DropDownList ID="ddlTrustworthy" runat="server" Width="450px">
                                                    </asp:DropDownList></td>
                                            </tr>
                                            <tr>
                                                <td width="210">
                                                    <asp:CheckBox ID="WhereDatabaseCollation" runat="server" AutoPostBack="True" Text=" Collation" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblDatabaseCollationEqual" runat="server" Text="="></asp:Label></td>
                                                <td>
                                                    <asp:DropDownList ID="ddlDatabaseCollation" runat="server" Width="450px">
                                                    </asp:DropDownList></td>
                                            </tr>
                                            <tr>
                                                <td width="210">
                                                    <asp:CheckBox ID="WhereDatabaseCompatibilityLevel" runat="server" AutoPostBack="True" Text=" Compatibility Level" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblDatabaseCompatibiliyLevelEqual" runat="server" Text="="></asp:Label></td>
                                                <td>
                                                    <asp:DropDownList ID="ddlDatabaseCompatibilityLevel" runat="server" Width="450px">
                                                    </asp:DropDownList></td>
                                            </tr>
                                            <tr>
                                                <td width="210">
                                                    <asp:CheckBox ID="WhereDatabasePageVerify" runat="server" AutoPostBack="True" Text=" Page Verify" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblDatabasePageVerify" runat="server" Text="="></asp:Label></td>
                                                <td>
                                                    <asp:DropDownList ID="ddlDatabasePageVerify" runat="server" Width="450px">
                                                    </asp:DropDownList></td>
                                            </tr>
                                            <tr>
                                                <td width="210">
                                                    <asp:CheckBox ID="WhereDatabaseIsSensitive" runat="server" AutoPostBack="True" 
                                                        Text="Is Sensitive" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblIsSensitive" runat="server" Text="Is"></asp:Label></td>
                                                <td>
                                                    <asp:RadioButtonList ID="rdoIsSensitive" runat="server" 
                                                        RepeatDirection="Horizontal" Width="164px">
                                                        <asp:ListItem Selected="True" Value="1">True</asp:ListItem>
                                                        <asp:ListItem Value="0">False</asp:ListItem>
                                                    </asp:RadioButtonList></td>
                                            </tr>
                                            <tr>
                                                <td width="210">
                                                    <asp:CheckBox ID="WhereDatabaseIsAudited" runat="server" AutoPostBack="True" 
                                                        Text="Is Audited" /></td>
                                                <td align="center" style="width: 50px">
                                                    <asp:Label ID="lblIsAudited" runat="server" Text="Is"></asp:Label></td>
                                                <td>
                                                    <asp:RadioButtonList ID="rdoIsAudited" runat="server" RepeatDirection="Horizontal" 
                                                        Width="164px">
                                                        <asp:ListItem Selected="True" Value="1">True</asp:ListItem>
                                                        <asp:ListItem Value="0">False</asp:ListItem>
                                                    </asp:RadioButtonList></td>
                                            </tr>
                                        </table>
                                        </td>
                                </tr>
                            </table>
    </td>
  </tr>
 </table>
<table id="Table2" cellpadding="1" cellspacing="0"  width="100%">
  <tr>
   <td bgcolor="#EBE7E7"><asp:Label ID="lblResults" runat="server" Font-Bold="False"></asp:Label></td>
  </tr>
  </table>
<table id="Table4" cellpadding="0" cellspacing="1"  width="100%">
  <tr>
                    <td>
                        <asp:GridView ID="gvResultsInstanceSearch" runat="server" cellpadding="3" 
                            OnRowCreated="gvResultsInstanceSearch_RowCreated" ForeColor="#333333"
                            GridLines="None" Width="100%" AllowSorting="False" CaptionAlign="Top">
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <Columns>
                                <asp:HyperLinkField DataNavigateUrlFields="instancename" DataNavigateUrlFormatString="~/InstanceDetail.aspx?InstanceName={0}"
                                    DataTextField="instancename" HeaderText="instance" NavigateUrl="~/InstanceDetail.aspx">
                                    <ItemStyle HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:HyperLinkField>
                            </Columns>
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                            <EditRowStyle BackColor="#999999" />
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#003366" Font-Bold="True" Font-Size="X-Small" ForeColor="White"
                                HorizontalAlign="Left" />
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        </asp:GridView>
                        <asp:GridView ID="gvResults" runat="server" cellpadding="3" 
                            OnRowCreated="gvResults_RowCreated" ForeColor="#333333"
                            GridLines="None" Width="100%" AllowSorting="False">
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <Columns>
                                <asp:HyperLinkField DataNavigateUrlFields="instancename" DataNavigateUrlFormatString="~/InstanceDetail.aspx?InstanceName={0}"
                                    DataTextField="instancename" HeaderText="instance" NavigateUrl="~/InstanceDetail.aspx">
                                    <ItemStyle HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:HyperLinkField>
                                <asp:HyperLinkField DataNavigateUrlFields="instancename,databasename" DataNavigateUrlFormatString="~/DatabaseDetail.aspx?InstanceName={0}&amp;DatabaseName={1}"
                                    DataTextField="databasename" HeaderText="databasename">
                                    <ItemStyle HorizontalAlign="Left" />
                                    <HeaderStyle HorizontalAlign="Left" />
                                </asp:HyperLinkField>
                            </Columns>
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                            <EditRowStyle BackColor="#999999" />
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#003366" Font-Bold="True" Font-Size="X-Small" ForeColor="White"
                                HorizontalAlign="Left" />
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        </asp:GridView>
                    </td>
                </tr> 
 </table>
</asp:Content>

